package mode.proxyMode07;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 07 代理模式
 */
public class DynamicProxyDemo implements InvocationHandler {

    private Object realObject;

    public DynamicProxyDemo(Object realObject) {
        this.realObject = realObject;
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before real subject do something ");
        Object result = method.invoke(realObject , args);
        System.out.println("after .. real subject do something ");

        return result;
    }




}
